﻿using System;

namespace WebBridge.Proxy
{
    class B1AHConnection : IB1AHConnection
    {
        private static volatile B1AHConnection _instance;
        private static readonly object _mutex = new object();

        private B1AHConnection()
        {
        }

        public static B1AHConnection Instance
        {
            get
            {
                if (_instance == null)
                {
                    lock (_mutex)
                    {
                        if (_instance == null)
                        {
                            _instance = new B1AHConnection();
                        }
                    }
                }
                return _instance;
            }
        }

        public void EnsureConnection(string spHost, string idpCookie)
        {
            Console.WriteLine("B1AH::Login, host={0}, cookie={1}", spHost, idpCookie);
        }

        public void DeployPackage(string package)
        {
            Console.WriteLine("B1AH::DeployPackage, package={0}", package);
        }
    }

    interface IB1AHConnection
    {
        void EnsureConnection(string spHost, string idpCookie);
        void DeployPackage(string package);
    }
}
